﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace DARE
{
    public class CSpriteMgr
    {
        #region fields

        private Dictionary<string, CSprite> m_entities;
        private CRender2D m_render;

        private Dictionary<string, CAnimationState.EAnimationType> m_types;

        #endregion

        #region ctor

        public CSpriteMgr(CRender2D render)
        {
            m_render = render;
            m_entities = new Dictionary<string, CSprite>();
            m_types = new Dictionary<string, CAnimationState.EAnimationType>();
            m_types.Add("Loop", CAnimationState.EAnimationType.LOOP);
            m_types.Add("Handle", CAnimationState.EAnimationType.HANDLE);
            m_types.Add("PingPong", CAnimationState.EAnimationType.PINGPONG);
        }

        #endregion

        #region methods


        public CSpriteMgr RegisterEntity(CSprite entity)
        {
            m_entities.Add(entity.Name, entity);
            return this;
        }

        public CSpriteMgr UnregisterEntity(CSprite entity)
        {
            m_entities.Remove(entity.Name);
            return this;
        }

        public CSprite CreateEntity(string createdEntityName, string registeredEntityName)
        {
            return m_entities[registeredEntityName].Clone(createdEntityName) as CSprite;
        }

        public CSprite CreateEntity(string createdEntityName, string registeredEntityName, CSprite parent)
        {
            return m_entities[registeredEntityName].Clone(createdEntityName, parent) as CSprite;
        }

        #endregion

    }
}
